Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improvement: set acceptAnonymousUploads=1 for initial kotsadm-tls cert #4344

Merged
merged 3 commits into from
Jan 12, 2024

Conversation

banjoh
Copy link
Member

@banjoh banjoh commented Jan 11, 2024

What this PR does / why we need it:

Have kurl-proxy service set acceptAnonymousUploads=1 in the kotsadm-tls cert by default when we generate the default self signed certificate. This allows prompting Admin Console users to upload BYO certs on first for first time installs. When KOTS is installed as a kURL addon, the installer script sets this flag to 1. Doing so in this service aligns with what's expected.

Which issue(s) this PR fixes:

Fixes # sc-94724

Special notes for your reviewer:

Steps to reproduce

Does this PR introduce a user-facing change?


Does this PR require documentation?

Review notes

  • I added some TODOs of some changes to consider. They are out of scope in this PR but would like your thoughts on them since the code was written a while back.

@@ -53,8 +52,6 @@ type cert struct {
func main() {
log.Printf("Commit %s\n", os.Getenv("COMMIT"))

rand.Seed(time.Now().UnixNano())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why remove this?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why remove this?

Accidental clean up as I was removing deprecated code. I meant to put it back.

We however do not need it. It was deprecated in go1.20. The runtime automatically generates a seed for us. Also, I do not see anywhere where we use random numbers.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we are safe to remove this unless there are objections.

I reviewed the code and do not see any reason for keeping it

Comment on lines 631 to 633
// TODO: Why is the namespace always "default"?
// Requests to kotsadm.embeddded-cluster.svc.cluster for example will
// fail with invalid cert errors
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure about the historical reasons, but kots and kurl-proxy are always deployed to the default namespace with the kurl add-on. If it needs to be other namespaces, i think we could make it configurable. Maybe even use the namespace variable we already have in the main function that comes from here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll add a change to allow overriding the namespace

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left the hostname as-is, but I have added DNS alt names to the cert in case the namespace is not default. This will keep any old assumptions valid such as in ekco's rotation logic


err = generateDefaultCertSecret(secrets, namespace)
if err != nil {
log.Printf("Could not regenerate default certificate: %v", err)
}
// TODO: Why are we exiting here? It leads to a pod restart
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure. on the surface, it seems like we dont need a restart for anything

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll leave that behaviour for now, but leave the TODO there so as not to introduce some unwanted behaviour change.

@banjoh banjoh force-pushed the em/sc-94724/set-acceptAnonymousUploads-to-1 branch from 55eb9bd to 1eba4b9 Compare January 12, 2024 13:38
@banjoh banjoh merged commit c185dc5 into main Jan 12, 2024
184 checks passed
@banjoh banjoh deleted the em/sc-94724/set-acceptAnonymousUploads-to-1 branch January 12, 2024 16:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants